﻿@using Volo.Abp.Ui.Branding
@inject IBrandingProvider BrandingProvider
@inherits BaseComponent
@if(Menu!=null && Menu.Items.Any())
{
<Bar ElementId="@ElementId" @ref="@Sidebar" Breakpoint="Breakpoint.Desktop" Class="@Class" Style="@Style" NavigationBreakpoint="Breakpoint" ThemeContrast="ThemeContrast.Light"
     Mode="BarMode.VerticalInline" CollapseMode="collapseMode" Shadow="Shadow.Default">
    @if (isBroken)
    {
        <BarBrand>
            <BarItem>
                <BarLink To="/">
                    @if (!BrandingProvider.LogoUrl.IsNullOrEmpty())
                    {
                    <img src="@BrandingProvider.LogoUrl" class="navbar-brand-logo" title="@BrandingProvider.AppName" />
                    }
                    @BrandingProvider.AppName
                </BarLink>
            </BarItem>
        </BarBrand>
    }
    <BarMenu>
        <BarStart>
            @foreach (var menuItem in Menu.Items)
            {
                @if (menuItem.IsLeaf){
                    <BarItem Disabled="@menuItem.IsDisabled">
                        <BarLink To="@menuItem.Url" Class="@menuItem.CssClass" Target="new Target(menuItem.Target)">
                            @if (menuItem.Icon != null)
                            {
                                <BarIcon IconName="menuItem.Icon" />
                            }
                            @menuItem.DisplayName
                        </BarLink>         
                    </BarItem>
                }
                else{
                    <BarItem Disabled="@menuItem.IsDisabled">
                        <SideNavMenuItem MenuItem="menuItem"></SideNavMenuItem>                    
                    </BarItem>
                }
            }
        </BarStart>
    </BarMenu>
</Bar>
}